import MySQLdb

from example01 import connect

conn = connect(database='hrs')
try:
    with conn.cursor(MySQLdb.cursors.DictCursor) as cursor:
        cursor.execute('select dno as no, dname as name, dloc as loc from tb_dept')
        for dept in cursor.fetchall():
            print(dept)
finally:
    conn.close()
